#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	string str;
	getline(cin, str, '\n');
    auto begin = str.begin(), end = str.end();
    reverse(begin, end);

    auto left = begin;
    auto right = begin;
    while(right < end)
    {
        while(right < end && *right != ' ')
        {
            ++right;
        }
        reverse(left, right);
        if(right != end)
        {
            left = right + 1;
        }
        ++right;
    }
    cout << str;
	return 0;
}